Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve first render white screen issue (#1482) #1797

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tomivm
Copy link
Collaborator

@tomivm tomivm commented Jan 8, 2025

Fixes #1482
My AI Agent made these changes. Review before merge

Problem

After a release, the first render of the app doesn't work, showing a white screen and throwing a SyntaxError: Unexpected token '<' error until the reload button is pressed.

Solution

This PR implements several fixes to resolve the first render issue:

  1. Updated service worker configuration:

    • Added proper navigation fallback handling
    • Improved caching strategy for static assets
    • Added whitelist for navigation fallback to exclude API routes
  2. Added proper cache control headers:

    • Set appropriate caching rules for static assets
    • Configured no-cache for dynamic content
    • Set immutable caching for JS/CSS bundles
  3. Added proper client-side routing handling:

    • Added _redirects file for proper SPA routing
    • Ensures all routes fall back to index.html with 200 status

Testing

To test this fix:

  1. Build the application
  2. Deploy to a test environment
  3. Access the application for the first time (clear cache if needed)
  4. Verify that the app loads properly without requiring a reload
  5. Test navigation to different routes to ensure they work correctly
  6. Verify that assets are properly cached

Notes

  • This fix addresses the issue by ensuring proper static asset delivery and routing handling
  • The changes maintain compatibility with existing caching mechanisms
  • Added additional optimization for static asset caching

tomivm added 2 commits January 8, 2025 20:21
- Update service worker configuration to properly handle navigation fallback
- Add proper cache control for static assets
- Improve client-side routing handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

After a release first Render of app don't work
1 participant